package com.zoo.diannaopeijian.domain;

import javax.persistence.*;

public class Stock {
    @Id
    @Column(name = "stock_id")
    private Integer stockId;

    @Column(name = "ware_id")
    private Integer wareId;

    @Column(name = "repertory_id")
    private Integer repertoryId;

    @Column(name = "stock_num")
    private Integer stockNum;

    /**
     * @return stock_id
     */
    public Integer getStockId() {
        return stockId;
    }

    /**
     * @param stockId
     */
    public void setStockId(Integer stockId) {
        this.stockId = stockId;
    }

    /**
     * @return ware_id
     */
    public Integer getWareId() {
        return wareId;
    }

    /**
     * @param wareId
     */
    public void setWareId(Integer wareId) {
        this.wareId = wareId;
    }

    /**
     * @return repertory_id
     */
    public Integer getRepertoryId() {
        return repertoryId;
    }

    /**
     * @param repertoryId
     */
    public void setRepertoryId(Integer repertoryId) {
        this.repertoryId = repertoryId;
    }

    /**
     * @return stock_num
     */
    public Integer getStockNum() {
        return stockNum;
    }

    /**
     * @param stockNum
     */
    public void setStockNum(Integer stockNum) {
        this.stockNum = stockNum;
    }

    public static Stock buildStock(PurchaseItem item) {
        Stock stock = new Stock();

        if (item == null) {
            return stock;
        }

        stock.setWareId(item.getWareId());
        stock.setStockNum(item.getPurItemNum());
        stock.setRepertoryId(item.getRepertoryId());

        return stock;
    }

    public static Stock buildStock(ShipmentItem item) {
        Stock stock = new Stock();

        if (item == null) {
            return stock;
        }

        stock.setWareId(item.getWareId());
        stock.setStockNum(item.getShiptItemNum());
        stock.setRepertoryId(item.getRepertoryId());

        return stock;
    }
}